"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const React = require("react");
const react_native_1 = require("react-native");
const Swipeable_1 = require("react-native-gesture-handler/Swipeable");
const connect_1 = require("../../redux/connect");
const { width, height } = react_native_1.Dimensions.get('window');
class Test extends React.PureComponent {
    constructor(props) {
        super(props);
        this.tmpData = [];
        this.max = -1;
        this.renderItem = (data) => {
            this.max = Math.max(this.max, data.item);
            return (<react_native_1.View style={styles.item}>
                <react_native_1.Text>Item {data.item}</react_native_1.Text>
                <react_native_1.TouchableOpacity onPress={() => this.setState({ max: this.max })}>
                    <react_native_1.View>
                        <react_native_1.Text>Press Me</react_native_1.Text>
                    </react_native_1.View>
                </react_native_1.TouchableOpacity>
            </react_native_1.View>);
        };
        this.renderLeftActions = (progress) => {
            const trans = progress.interpolate({
                inputRange: [0, 1],
                outputRange: [-width, 0],
            });
            return (<react_native_1.View style={[styles.view]}>
                <react_native_1.Animated.View style={[
                styles.view2,
                { transform: [{ translateX: trans }], flex: 1 }
            ]}>
                    <react_native_1.Text>adlfkjaslfkjdslkfj</react_native_1.Text>
                    <react_native_1.TouchableOpacity onPress={() => this.props._u_nav_navTo('Test2', { a: 'isApple', b: true, c: 0x00FF00, u: null })}>
                        <react_native_1.View>
                            <react_native_1.Text>Navvvvvvvvvvvvvvv</react_native_1.Text>
                        </react_native_1.View>
                    </react_native_1.TouchableOpacity>
                    <react_native_1.ScrollView horizontal={true}>
                        <react_native_1.View style={styles.subItem}/>
                        <react_native_1.View style={styles.subItem}/>
                        <react_native_1.View style={styles.subItem}/>
                        <react_native_1.View style={styles.subItem}/>
                        <react_native_1.View style={styles.subItem}/>
                        <react_native_1.View style={styles.subItem}/>
                        <react_native_1.View style={styles.subItem}/>
                        <react_native_1.View style={styles.subItem}/>
                        <react_native_1.View style={styles.subItem}/>
                        <react_native_1.View style={styles.subItem}/>
                        <react_native_1.View style={styles.subItem}/>
                        <react_native_1.View style={styles.subItem}/>
                    </react_native_1.ScrollView>
                    <react_native_1.Text>adlfkjaslfkjdslkfj</react_native_1.Text>
                    <react_native_1.Text>adlfkjaslfkjdslkfj</react_native_1.Text>
                    <react_native_1.Text>adlfkjaslfkjdslkfj</react_native_1.Text>
                    <react_native_1.Text>adlfkjaslfkjdslkfj</react_native_1.Text>
                    <react_native_1.Text>adlfkjaslfkjdslkfj</react_native_1.Text>
                </react_native_1.Animated.View>
            </react_native_1.View>);
        };
        this.renderRightActions = (progress) => {
            const trans = progress.interpolate({
                inputRange: [0, 1],
                outputRange: [width, 0],
            });
            return (<react_native_1.View style={[styles.view]}>
                <react_native_1.Animated.View style={[
                styles.view3,
                { transform: [{ translateX: trans }], flex: 1 }
            ]}>
                    <react_native_1.Text>view 3 asldfkjasldfkj dsaf</react_native_1.Text>
                    <react_native_1.TouchableOpacity onPress={() => {
                this.props._m_common_init();
            }}>
                        <react_native_1.View>
                            <react_native_1.Text>http</react_native_1.Text>
                        </react_native_1.View>
                    </react_native_1.TouchableOpacity>
                    <react_native_1.ScrollView horizontal={true}>
                        <react_native_1.View style={styles.subItem}/>
                        <react_native_1.View style={styles.subItem}/>
                        <react_native_1.View style={styles.subItem}/>
                        <react_native_1.View style={styles.subItem}/>
                        <react_native_1.View style={styles.subItem}/>
                        <react_native_1.View style={styles.subItem}/>
                        <react_native_1.View style={styles.subItem}/>
                        <react_native_1.View style={styles.subItem}/>
                        <react_native_1.View style={styles.subItem}/>
                        <react_native_1.View style={styles.subItem}/>
                        <react_native_1.View style={styles.subItem}/>
                        <react_native_1.View style={styles.subItem}/>
                    </react_native_1.ScrollView>
                    <react_native_1.Text>view 3 asldfkjasldfkj dsaf</react_native_1.Text>
                    <react_native_1.Text>view 3 asldfkjasldfkj dsaf</react_native_1.Text>
                    <react_native_1.Text>view 3 asldfkjasldfkj dsaf</react_native_1.Text>
                    <react_native_1.Text>view 3 asldfkjasldfkj dsaf</react_native_1.Text>
                </react_native_1.Animated.View>
            </react_native_1.View>);
        };
        for (let i = 0; i < 100; i++) {
            this.tmpData.push(i);
        }
        this.state = {
            max: this.max,
        };
    }
    render() {
        return (<Swipeable_1.default renderLeftActions={this.renderLeftActions} renderRightActions={this.renderRightActions} overshootLeft={false}>
                <react_native_1.View style={[styles.view, styles.view1]}>
                    <react_native_1.Text>Max Render:{this.state.max}</react_native_1.Text>
                    <react_native_1.FlatList pagingEnabled={true} data={this.tmpData} keyExtractor={item => item + ''} renderItem={this.renderItem}/>
                </react_native_1.View>
            </Swipeable_1.default>);
    }
}
const styles = react_native_1.StyleSheet.create({
    view: {
        width, height,
    },
    view1: {
        backgroundColor: 'red',
    },
    view2: {
        backgroundColor: 'yellow',
    },
    view3: {
        backgroundColor: 'green',
    },
    item: {
        height,
        padding: 10,
        borderColor: 'black',
        borderWidth: 1,
        borderRadius: 10,
    },
    subItem: {
        width: 100,
        height: 100,
        backgroundColor: 'pink',
        borderRadius: 50,
    },
    txt: {
        textAlign: 'right',
        width: '100%',
    },
});
exports.default = connect_1.default(null, null, Test, {});
